package panel.mapPanel
{
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	
	import struct.Hotel;
	import struct.Restaurant;
	import struct.Scenic;
	import struct.ScenicShop;
	
	public class FloatIcon extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _uri:URI;
		
		private var content:*;
		
		private var img:Bitmap;
		
		public function FloatIcon(stage:Stage,loader:ResourceLoader,uri:URI)
		{
			_stage = stage;
			_loader = loader;
			_uri = uri;
		}
		
		public function changeData(obj:*):void
		{
			content = obj;
			
			if(obj is Scenic){
				img = new _loader.uiManager.timeLineScenic as Bitmap;
			}
			if(obj is Restaurant){
				img = new _loader.uiManager.timeLineEating as Bitmap;
			}
			if(obj is ScenicShop){
				img = new _loader.uiManager.timeLineFun as Bitmap;
			}
			if(obj is Hotel){
				img = new _loader.uiManager.timeLineHotel as Bitmap;
			}
			if(obj is String && obj == "start"){
				img = new _loader.uiManager.timeLineMarkStart as Bitmap;
			}
			if(obj is String && obj == "end"){
				img = new _loader.uiManager.timeLineMarkEnd as Bitmap;
			}
			
			this.addChild(img);
		}
		
		public function resize():void
		{
			if(content is String){
				img.width = _stage.stageWidth * .08;
				img.height = img.width;
			}else{
				img.width = _stage.stageWidth * .15;
				img.height = img.width;
			}
		}
		
		public override function get width():Number
		{
			return this.img.width;
		}
		
		public override function get height():Number
		{
			return this.img.height;
		}
	}
}